<template>
  <div class="classify app_content">
    <!-- 导航栏  titelText="详情信息"-->
    <div class="header_body">
      <header-nav :slefBack="true" @goBack="goBack"> </header-nav>
    </div>
    <div class="detail_body">
      <van-cell-group inset>
        <van-cell :title="itemInfo.title" />
<!--        <van-cell title="标题" :value="itemInfo.title" />-->
        <van-cell title="地区" :value="itemInfo.cityName + itemInfo.districtName" />
        <van-cell title="时间" :value="itemInfo.releaseTime" />
        <van-cell title="来源" :value="itemInfo.source" />
        <van-cell title="作者" :value="itemInfo.author" />
        <van-cell  v-for="(item, index) in itemInfo.fileList"
                   :title="'附件' + (index + 1)">
          <template #value>
            <span class="text-button" @click="download(item)">下载</span>
          </template>
        </van-cell>
        <van-cell title="内容">
          <template #label>
            <div v-html="itemInfo.content"/>
          </template>
        </van-cell>
      </van-cell-group>
    </div>
  </div>
</template>
<script setup name="ItemInfo">
import {showDialog} from "vant";
import {DELETE_ADVICE, GET_ADVICE_LIST} from "@/api/cooperativeOffice/serviceAdvisory.js";

const router = useRouter();
const itemInfo = ref({})
onMounted(() => {
  const query = router?.currentRoute?.value?.query;
  itemInfo.value = JSON.parse(query.itemInfo)
  if (!itemInfo.value.longAnnex) {
    return;
  }
  itemInfo.value.fileList = itemInfo.value.longAnnex.split(",")
})
const download = (item) => {
  window.open(item); //url为下载http地址
}
const goBack = () => {
  router.go(-1);
};

</script>
<style lang="less" scoped>
.text-button {
  color: #1989fa;
}
.classify {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: #f4f4f4;
}
</style>